<?php 
$desW= 200;
$desH = 100;
//创建画布
$dseImg = imagecreatetruecolor($desW, $desH);
//原图
$srcImg = imagecreatefromjpeg('./shanghai.jpg');
$srcW= imagesx($srcImg);
$srcH = imagesy($srcImg);
//拷贝图像
imagecopyresized($dseImg, $srcImg, 0, 0, 0, 0, $desW, $desH, $srcW, $srcH);

//保存图片
imagejpeg($dseImg,'./shanghai_w.jpg');
//销毁图片
imagedestroy($dseImg);
imagedestroy($srcImg);



 ?>